import {QL} from 'iflux2'

export const maxSelectedGoodsNumQL = QL('maxSelectedGoodsNumQL', [
    'goodsList',
    (goodsList) => (50 - goodsList.count())
]);

export const insertKeyIntoAddedGoodsQL = QL('insertKeyIntoAddedGoodsQL', [
    'type',
    'goodsAddedList',
    (type, goodsAddedList) => goodsAddedList.map((goods)=>goods.set('key', !type ? goods.get('goodsId') : goods.get('productId')))
])